'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const q = require('../nodes/YAMLSeq.cjs'),
  S = require('./resolve-props.cjs'),
  h = require('./util-flow-indent-check.cjs');
function p({ composeNode: a, composeEmptyNode: d }, n, l, o, c) {
  const r = (c == null ? void 0 : c.nodeClass) ?? q.YAMLSeq,
    i = new r(n.schema);
  n.atRoot && (n.atRoot = !1);
  let s = l.offset,
    u = null;
  for (const { start: m, value: t } of l.items) {
    const e = S.resolveProps(m, {
      indicator: 'seq-item-ind',
      next: t,
      offset: s,
      onError: o,
      startOnNewline: !0,
    });
    if (!e.found)
      if (e.anchor || e.tag || t)
        t && t.type === 'block-seq'
          ? o(
              e.end,
              'BAD_INDENT',
              'All sequence items must start at the same column',
            )
          : o(s, 'MISSING_CHAR', 'Sequence item without - indicator');
      else {
        (u = e.end), e.comment && (i.comment = e.comment);
        continue;
      }
    const f = t ? a(n, t, e, o) : d(n, e.end, m, null, e, o);
    n.schema.compat && h.flowIndentCheck(l.indent, t, o),
      (s = f.range[2]),
      i.items.push(f);
  }
  return (i.range = [l.offset, s, u ?? s]), i;
}
exports.resolveBlockSeq = p;
